package com.tencent.iov.cowin.befsale.clue.value.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * @Describe: 战败审批状态类型
 * @author: whp
 * @created: 2021-12-27 18:22:10
 * @version: 1.0
 */
@Getter
@AllArgsConstructor
public enum FailStatusEnum {
   //	/**战败状态（0待审批，1同意战败、2拒绝战败 3战败激活**/
   APPROVAL_PENDING(0,"待审批"),
    AGREE(1,"同意战败"),
    REFUSE(2,"拒绝战败"),
    ACTIVATE(3,"战败激活");


    Integer code;
    String name;


    /**
     * 跟进type获
     * @param code
     * @return
     */
    public static String getDictionaries(Integer code){
        for (FailStatusEnum fs : FailStatusEnum.values()) {
            if(fs.getCode().equals(code)){
                return fs.getName();
            }
        }
        return null;
    }

    public static FailStatusEnum getByCode(Integer code) {
        return Stream.of(FailStatusEnum.values())
                .filter(enums -> enums.code.equals(code))
                .findAny().orElse(null);
    }

}
